package org.bling.star.common.response;

import java.io.Serializable;

public class BaseResponse implements Serializable {
    private static final long serialVersionUID = -4147526235569834363L;
    private int code;
    private String message;
    private Object data;
    public BaseResponse(Object data) {
        this.code = 200;
        this.message = "success";
        this.data = data;
    }

    public BaseResponse(Integer code, Object data,String messaage) {
        this.code = code;
        this.message = messaage;
        this.data = data;
    }

    public static BaseResponse success() {
        return new BaseResponse(true);
    }

    public static BaseResponse fail() {
        return new BaseResponse(500, null, "fail");
    }

    public static BaseResponse success(Object data) {
        return new BaseResponse(data);
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public Object getData() {
        return this.data;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof BaseResponse)) return false;
        final BaseResponse other = (BaseResponse) o;
        if (!other.canEqual(this)) return false;
        if (this.getCode() != other.getCode()) return false;
        final Object this$message = this.getMessage();
        final Object other$message = other.getMessage();
        if (this$message == null ? other$message != null : !this$message.equals(other$message)) return false;
        final Object this$data = this.getData();
        final Object other$data = other.getData();
        return this$data == null ? other$data == null : this$data.equals(other$data);
    }

    protected boolean canEqual(final Object other) {
        return other instanceof BaseResponse;
    }

    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        result = result * PRIME + this.getCode();
        final Object $message = this.getMessage();
        result = result * PRIME + ($message == null ? 43 : $message.hashCode());
        final Object $data = this.getData();
        result = result * PRIME + ($data == null ? 43 : $data.hashCode());
        return result;
    }

    public String toString() {
        return "BaseResponse(code=" + this.getCode() + ", message=" + this.getMessage() + ", data=" + this.getData() + ")";
    }
}
